Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

470
Views
I get "laravel: command not found" on Ubuntu 20.04

I did a fresh install of Ubuntu 20.04 LTS (Focal Fossa), installed Apache, PHP, MySQL and PHP Composer seemingly without issue. However, I still cannot get laravel -V to give me a version number.

I have looked at a multitude of YouTube videos and tried my interpretation of the recommendations found here on Stack Overflow. How can I fix it?

Here's the output on my shell $PATH.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You must add PHP Composer binaries folder to your $PATH if you'd like to call the binaries globally.


A) Make sure you have the latest Laravel installer:

composer global require laravel/installer

B) Add composer bin folder to your $PATH:

  1. Edit your .bashrc file: gedit $HOME/.bashrc

  2. Add the following line: export PATH="$PATH:$HOME/.config/composer/vendor/bin"

C) Use the source command to force Ubuntu to reload your .bashrc file:

source $HOME/.bashrc

D) Try to output Laravel installer's version:

laravel -V


Additional explanations as requested:

To execute a command from the Linux terminal, you need to tell Linux where the program is located.

For example, you could have launched Laravel installer using the full path: $HOME/.config/composer/vendor/bin/laravel -V

But instead, you wanted to be able to call the laravel -V command directly because you don't want to type the full path every time.

Since you are on Ubuntu, the default shell program is Bash. You need to tell Bash where to look when you type a command. In this case, you want Bash to look in the $HOME/.config/composer/vendor/bin/ folder.

The configuration file for Bash is a hidden file called .bashrc located in the user home folder. Bash stores the list of special folders in a variable called $PATH. To add a new folder, we simply added it to the $PATH variable.

If you type echo $PATH in your terminal, Bash will output the content of the $PATH variable and you will see a list of folders.

Now you may ask: "Why did I have to do this? I usually don't have to mess with my Bash configuration". Yes, this is because you usually install Ubuntu packages and they are configured to work out of the box. In this case, you installed a composer package in your home directory and it's therefore up to you to configure it the way you want.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!